#ifndef FRACALCDATATABLEMODEL_H
#define FRACALCDATATABLEMODEL_H

#include <QAbstractTableModel>

class FrakOutData;
class FrakOutDataItem;

class FrakOutDataTableModel : public QAbstractTableModel
{
public:
    static const QString ColumnCellSizeString;
    static const QString ColumnNumCellsString;
    static const QString ColumnFractalDimensionString;
    static const int ColumnCellSize;
    static const int ColumnNumCells;
    static const int ColumnFractalDimension;
    static const int ColumnCount;

public:
    FrakOutDataTableModel(FrakOutData& fracalcData, QObject *parent = 0);
    void addCellForRow(int row, const QPair<int,int>& cell);
    void addToBeginning(const FrakOutDataItem& item);
    void addToEnd(const FrakOutDataItem& item);
    void clear();
    int columnCount(const QModelIndex &parent) const;
    QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;
    QVariant headerData(int section, Qt::Orientation orientation, int role) const;
    void removeCellForRow(int row, const QPair<int,int>& cell);
    void removeCellsForRow(int row);
    void removeFromBeginning();
    void removeFromEnd();
    bool removeRows(int row, int count, const QModelIndex &parent=QModelIndex());
    int rowCount(const QModelIndex &parent) const;
    void setCellsForRow(int row, const QSet<QPair<int,int> >& cells);
    void updateModel();

private:

    /** A reference to the data wrapped by this model. */
    FrakOutData& m_fracalcData;
};

#endif // FRACALCDATATABLEMODEL_H
